
package controller;

import gui.Prompt;
import gui.Scene;
import gui.properties.Properties;
import gui.Toolbar;
import gui.workspace.Workspace;

import javax.swing.JComponent;

import model.Model;

/**
 * Controller class in charge of handling general windows manipulations for system(i.e visiblity)
 * 
 * @author Troy Ferrell
 */

public class WindowsController extends AbstractController
{

	public WindowsController(Model model) 
	{
		super(model);
	}
	
	// TODO: Know redudance in code below. Error with reflection when
	// trying to use one method setVisibility(JComponent target)
	
	// TODO: error with visibility, when becoming invisible, splitpanes
	// in the view adjust for the absent component. However, when becomes visible,
	// split panes don't readjust for the component coming back.
	/**
	 * Flip visiblity of target component
	 * 
	 * @param target 
	 */
	public void setVisibility(JComponent target)
	{
		boolean visible = target.isVisible();
		target.setVisible(!visible);
	}
	
	public void setToolbarVisiblity(Toolbar target)
	{
		setVisibility(target);
	}

	public void setSceneVisiblity(Scene target)
	{
		setVisibility(target);
	}
	
	public void setWorkspaceVisiblity(Workspace target)
	{
		setVisibility(target);
	}
	
	public void setPromptVisiblity(Prompt target)
	{
		setVisibility(target);
	}
	
	public void setPropertiesVisiblity(Properties target)
	{
		setVisibility(target);
	}
}
